//
//  MMReleaeTableView1.m
//  Gunz
//
//  Created by Joggy on 16/5/22.
//  Copyright © 2016年 NUPT. All rights reserved.
//

#import "MMReleaseTableView1.h"
#import "MMReleaseViewCell.h"
#import "MJRefresh.h"
#import "TaskDetailViewController.h"

@interface MMReleaseTableView1 ()<UITableViewDelegate, UITableViewDataSource> {
    
    UITableView *table;
    
}
@end

@implementation MMReleaseTableView1

- (void)viewDidLoad {
    [super viewDidLoad];
    [self prepareForLayout];
}

- (void)prepareForLayout {
    [super prepareForLayout];
    table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight - 64)];
    table.delegate = self;
    table.dataSource = self;
    table.backgroundColor = [UIColor clearColor];
    table.separatorStyle = UITableViewCellSeparatorStyleNone;
    [table registerClass:[MMReleaseViewCell class] forCellReuseIdentifier:@"MMReleaseCell1"];
    table.showsVerticalScrollIndicator = false;
    table.showsHorizontalScrollIndicator = false;
    table.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
    [self.view addSubview:table];
    [table.mj_header beginRefreshing];
}

- (void)headerRefresh {
    [table.mj_header endRefreshing];
}

-(void)back {
    [self.navigationController popViewControllerAnimated:true];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma 代理方法

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:true];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 6;
}

- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, MineVCInsert)];
    headView.backgroundColor = [UIColor clearColor];
    return headView;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return MineVCInsert;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return MineVCCellHeight;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    MMReleaseViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MMReleaseCell1"];
    cell.statusLabel.text = @"待修改";
    return cell;
}

@end
